package com.talent.service.auth.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @ClassName：UserInfoController
 * @Author: hszhou
 * @Date: 2025/2/13 16:07
 * @Description: 必须描述类做什么事情, 实现什么功能
 */
@RestController
public class UserInfoController {

    /**
     * 获取用户
     * @param user
     * @return
     *
     */
    @GetMapping("/user/info")
    public Principal user(Principal user) {
        //使用ThreadLocal 存储用户信息，方便后续使用
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return user;
    }
}
